<template>
    <div class="adminAudit">
        <div>
            <el-steps class="steps" :active="active" finish-status="success">
                <el-step title="申请开店"></el-step>
                <el-step title="开店须知"></el-step>
                <el-step title="店铺信息"></el-step>
                <el-step title="平台审核"></el-step>
                <el-step title="在线签约"></el-step>
            </el-steps>
             <div v-if="!temp.status" class="auditFont">平台工作人员正在审核中,请耐心等待审核</div>
             <div v-if="temp.status == 1" class="auditFont" @click="goOnline()"><img src="./img/pass.jpg"></div>
             <div v-if="temp.status == 2" class="auditFont" @click="goUpdate()"><img src="./img/nopass.jpg"></div>
        </div>
        <div class="img"><img src="./img/delAudit.jpg" @click="dialogVisible = true" style="width: 80px;float:right"></div>
        <el-dialog
                title="正在操作撤销店铺入驻申请"
                :visible.sync="dialogVisible"
                width="30%"
                :before-close="handleClose">
            <span>用户编号:<input style="height: 20px" v-model ="userCode" ></span><br>
            <span>身份证号:<input style="height: 20px;margin-top: 10px" v-model ="userCard" ></span>
            <span slot="footer" class="dialog-footer">
                <el-button @click="dialogVisible = false">取 消</el-button>
                <el-button type="primary" @click="delShop()">确 定</el-button>
              </span>
        </el-dialog>
    </div>
</template>
<script scoped>
    import {delShop} from '@/api/shop'
    export default {
        data() {
            return{
                userCard:null,
                userCode:null,
                active:3,
                status:null,
                dialogVisible:false,
                temp: {
                    userAddress:null,
                    cardImg:null,
                    userName: null,
                    userCard: null,
                    brandName: null,
                    brandInfo: null,
                    shopName:null,
                    shopPhone:null,
                    userPhone:null,
                    managePhone:null,
                    slogan:null,
                    name:null,
                    manageName:null,
                    remark:null,
                    userCode:null,
                    mcode:null,
                    avatar:null,
                    card:null,
                    shopbusImg:null,
                    shopAddress:null
                },
                sysUser:{
                    username:null,
                    password:null
                }
                ,

            }

        },
        created() {

            if (this.$route.params.temp){
                this.temp = this.$route.params.temp;
            }
            if (this.$route.params.userCode){
                this.temp.userCode = this.$route.params.userCode;
            }
        },
        methods:{
            delShop(){
                this.$confirm('是否确认撤销店铺入驻申请？')
                    .then(_ => {
                        if (this.userCode == null || this.userCode == ''){
                            this.$message.error("请输入用户编号");
                            return
                        }
                        if (this.userCard == null || this.userCard == ''){
                            this.$message.error("请输入用户身份证号码");
                            return
                        }
                        delShop(this.userCode,this.userCard).then(res =>{
                            if (res.code == 10000){
                                this.$message.success("撤销入驻申请成功")
                                this.dialogVisible = false;
                            }else {
                                this.$message.error("撤销入驻申请失败")
                            }
                        })
                    })
                    .catch(_ => {});

            },
            handleClose(done) {
                this.$confirm('确认关闭？')
                    .then(_ => {
                        done();
                    })
                    .catch(_ => {});
            },
            goOnline(){
                this.$router.push({name: 'online',params:{}})
            },
            goUpdate(){
                this.$router.push({name: 'shopAudit',params:{temp:this.temp}})
            }
        }

    }
</script>
<style>
    .adminAudit {
        width: 800px;
        margin: 0 auto;
    }
    .steps{
        margin-top: 50px;
    }
    .auditFont{
        margin-top: 100px;
        text-align: center;
    }
    .img{
        position: fixed;
        top: 390px;
        right: 0;
    }
</style>
